<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ include file="/views/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>【众筹平台排名】最新影视众筹，股权众筹，店铺众筹平台排名_影视众筹，股权众筹，店铺众筹平台成交排名_影视众筹，股权众筹，店铺众筹平台分红排名-众秀众筹</title>
	<meta name="Keywords" content="影视众筹平台排名，股权众筹平台排名，众筹排名，店铺众筹排名，影视众筹排名，股权众筹排名，店铺众筹排名，影视众筹分红，股权众筹退出，店铺众筹分红，店铺众筹退出" />
	<meta name="Description" content="众秀众筹众筹数据栏目提供影视众筹平台，股权众筹平台，店铺众筹平台分红，退出的排名、最新众筹平台成交排名,影视众筹，股权众筹，店铺众筹项目成交数据。了解更多众筹数据排名就到众秀众筹众筹平台排名众筹数据栏目析。" />
	<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
	<meta name="renderer" content="webkit"/>
	<link rel="stylesheet" href="<%=path%>/css/bootstrap/3.3.5/css/bootstrap.min.css" />
	<link rel="stylesheet" href="<%=path%>/css/cropper.min.css" />
	<link rel="stylesheet" href="<%=path%>/css/cz.css" />

	<script src="<%=path%>/js/jquery-1.11.0.min.js"></script>
	<script src="<%=path%>/js/plugins/datapicker/bootstrap-datepicker.js"></script>
	<script src="<%=path%>/js/plugins/layer/layer.js"></script>
	<script src="<%=path%>/css/bootstrap/3.3.5/js/bootstrap.min.js"></script>

	<script type="text/javascript" src="<%=path%>/js/slider.js"></script>
	<script type="text/javascript" src="<%=path%>/js/cropper.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/common.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			var platformType='${projectDataVO.platformType}';
			changePlatformType(platformType);
		});
	
		function changePlatformType(type){
			if(type=='1'){
				$("#data_2_3").hide();
				$("#data_1").show();
			}else{
				$("#data_2_3").show();
				$("#data_1").hide();
			}
		}
	
	</script>
</head>
<body class="gray-bg">
<jsp:include page="/views/commons/header.jsp"></jsp:include>
<div class="container page-single">
	<div class="col-md-12">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title">数据编辑</h3>
			</div>
			<div class="panel-body event-create">
				<form class="form-horizontal" id="project_data_form" action="javascript:insertProjectData()">
					<input type="hidden" name="projectDataId" value="${projectDataVO.projectDataId}"/>
					<div class="form-group">
						<label class="col-sm-1 control-label">项目名<em>*</em></label>
						<div class="col-sm-10">
							<input type="text" class="form-control" placeholder="项目名" name="projectName" 
							value="${projectDataVO.projectName}">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-1 control-label">平台名<em>*</em></label>
						<div class="col-sm-10">
							<input type="text" class="form-control" placeholder="上线平台" name="platformName" 
							value="${projectDataVO.platformName}">
						</div>
					</div>
					<d:radio describe="平台类型" tableColumn="platform_type" fieldName="platformType" value="${projectDataVO.platformType}" queryFunction="changePlatformType"></d:radio>
					
					<div id="data_2_3">
						<div class="form-group">
							<label class="col-sm-1 control-label">募资金额(元)<em>*</em></label>
							<div class="col-sm-10">
								<input type="text" class="form-control" placeholder="募资金额" name="raisedAmount" id="raised_amount"
								value="${projectDataVO.raisedAmount}" onBlur="changeDividendRate()">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-1 control-label">累计分红(元) <em>*</em></label>
							<div class="col-sm-10">
								<input type="text" class="form-control" placeholder="累计分红 " name="totalDividend"  id="total_dividend"
								value="${projectDataVO.totalDividend}" onBlur="changeDividendRate()">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-1 control-label">项目运营时间(月)<em>*</em></label>
							<div class="col-sm-10">
								<input type="text" class="form-control" placeholder="项目运营时间(月)" name="operationTime" id="operation_time"
								value="${projectDataVO.operationTime}" onBlur="changeDividendRate()">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-1 control-label">分红/募资金额<em>*</em></label>
							<div class="col-sm-10">
								<input type="text" class="form-control" placeholder="分红/募资金额" name="dividendRatio" id="dividend_ratio"
								value="${projectDataVO.dividendRatio}" readonly="readonly">
							</div>
						</div>
					</div>
					<div id="data_1">
						<div class="form-group">
							<label class="col-sm-1 control-label">募集后估值(元)<em>*</em></label>
							<div class="col-sm-10">
								<input type="text" class="form-control" placeholder="募集后估值" name="valuationAfterRaised" id="valuation_after_raised"
								value="${projectDataVO.valuationAfterRaised}" onBlur="changeAppreciationRate()">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-1 control-label">下一轮融资估值(元)</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" placeholder="下一轮融资估值" name="nextValuation" id="next_valuation"
								value="${projectDataVO.nextValuation}" onBlur="changeAppreciationRate()">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-1 control-label">升值比例(%)</label>
							<div class="col-sm-10">
								<input type="text" class="form-control" placeholder="升值比例" name="appreciationRatio"  id="appreciation_ratio"
								value="${projectDataVO.appreciationRatio}"  readonly="readonly">
							</div>
						</div>
						<d:radio describe="下轮融资类型" tableColumn="valuation_type" fieldName="valuationType" value="${projectDataVO.valuationType}"></d:radio>
					</div>
					<div class="form-group">
						<div class="col-sm-9 col-sm-offset-2">
							<button  class="btn btn-primary" id="project_confirm_btn" >提交</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

<jsp:include page="/views/commons/footer.jsp"></jsp:include>

<link rel="stylesheet" href="<%=path %>/js/plugins/kindeditor/themes/default/default.css" />
<script charset="utf-8" src="<%=path %>/js/plugins/kindeditor/kindeditor-all.js"></script>
<script charset="utf-8" src="<%=path %>/js/plugins/kindeditor/lang/zh_CN.js"></script>

<script type="text/javascript">
	
	function insertProjectData(){
		$("#project_confirm_btn").addClass("disabled").attr("disabled","disabled").val("提交中");
		$.ajax({
			url : path + "/admin/data/update",
			type : "post",
			dataType : "json",
			data : $("#project_data_form").serialize(),
			success : function(data)
			{
				if(data.result){
					layer.msg("发布成功",{icon: 1});;
					window.location.href=path + "/views/data/data_list.jsp";
				}else{
					layer.msg(data.message,{icon: 2});;
					$("#project_confirm_btn").removeClass("disabled").removeAttr("disabled").val("提交");
				}
			},error:function(){
				layer.msg("服务器网络繁忙",{icon: 2});
				$("#project_confirm_btn").removeClass("disabled").removeAttr("disabled").val("提交");
			}
		});
	}
	function changeAppreciationRate(){
		var valuationAfterRaised=$("#valuation_after_raised").val();
		var nextValuation=$("#next_valuation").val();
		if(valuationAfterRaised!=''&&nextValuation!=''){
			$("#appreciation_ratio").val((parseFloat(nextValuation)/parseFloat(valuationAfterRaised)*100).toFixed(2));
		}
		
	}
	
	function changeDividendRate(){
		var raisedAmount=$("#raised_amount").val();
		var totalDividend=$("#total_dividend").val();
		if(raisedAmount!=''&&totalDividend!=''){
			$("#dividend_ratio").val((parseFloat(totalDividend)/parseFloat(raisedAmount)*100).toFixed(2));
		}
	}
</script>
</body>
</html>